-
Notifications
You must be signed in to change notification settings - Fork 57
fix: align V4 code login with app #657
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 9 files with indirect coverage changes 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes the V4 code login implementation to properly align with the Roborock app's authentication flow. The changes ensure the API requests match the expected format by switching from query parameters to form-encoded request body data and adding required headers.
- Switched from
paramstodatain bothrequest_code_v4()andcode_login_v4()functions to properly send data as form-encoded in the request body - Added additional required headers for V4 login including app version, phone system, phone model, and language settings
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "Content-Type": "application/x-www-form-urlencoded", | ||
| "header_clientlang": "en", | ||
| "header_appversion": "4.54.02", | ||
| "header_phonesystem": "iOS", | ||
| "header_phonemodel": "iPhone16,1", | ||
| }, |
Copilot
AI
Dec 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a comment explaining why these specific header values (Content-Type, language "en", phone system "iOS", phone model "iPhone16,1") are required for the V4 API. This would help future maintainers understand if these values need to be adjusted or made configurable.
| "x-mercy-k": x_mercy_k, | ||
| "Content-Type": "application/x-www-form-urlencoded", | ||
| "header_clientlang": "en", | ||
| "header_appversion": "4.54.02", |
Copilot
AI
Dec 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hardcoded app version "4.54.02" may become outdated as the Roborock app is updated. Consider adding a comment explaining why this specific version is used, or if possible, making it configurable to ensure future compatibility with the API.
The fix is the extra headers, it does not seem like any can be removed.
The api also accepts params or data, but data better aligns to the app, so we are switching to that.
home-assistant/core#158306